package com.code.controller;

import com.code.entity.HistoryLine;
import com.code.service.HistoryService;
import com.code.util.ResultData;
import org.springframework.web.bind.annotation.*;

/**
 * 历史时间线
 *
 * @author wwei
 * @date 2019/8/7
 */
@RestController
@RequestMapping("/history")
public class HistoryController {

    private final HistoryService historyService;

    public HistoryController(HistoryService historyService) {
        this.historyService = historyService;
    }

    @GetMapping("/getHistory")
    public ResultData getHistory (Long userId) {
        return historyService.getHistory(userId);
    }

    @PostMapping("/saveHistory")
    public ResultData saveHistory(@RequestBody HistoryLine historyLine) {
        return historyService.saveHistory(historyLine);
    }
}
